using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using SJVars;
using SJXmlP.XMLClasses;
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using yW5Lib;
using yWriter6.My.Resources;

namespace yWriter6
{
	[DesignerGenerated]
	internal class frmPickChapters : Form
	{
		private IContainer components;

		public ToolTip ToolTip1;

		[CompilerGenerated]
		[AccessedThroughProperty("cmdAll")]
		private Button _cmdAll;

		[CompilerGenerated]
		[AccessedThroughProperty("cmdCancel")]
		private Button _cmdCancel;

		[CompilerGenerated]
		[AccessedThroughProperty("cmdOk")]
		private Button _cmdOk;

		[CompilerGenerated]
		[AccessedThroughProperty("cmbLastChapter")]
		private ComboBox _cmbLastChapter;

		[CompilerGenerated]
		[AccessedThroughProperty("cmbFirstChapter")]
		private ComboBox _cmbFirstChapter;

		[CompilerGenerated]
		[AccessedThroughProperty("Label2")]
		private Label _Label2;

		[CompilerGenerated]
		[AccessedThroughProperty("Label1")]
		private Label _Label1;

		[CompilerGenerated]
		[AccessedThroughProperty("chkUnused")]
		private CheckBox _chkUnused;

		[CompilerGenerated]
		[AccessedThroughProperty("lblTags")]
		private Label _lblTags;

		[CompilerGenerated]
		[AccessedThroughProperty("txtTags")]
		private TextBox _txtTags;

		[CompilerGenerated]
		[AccessedThroughProperty("lblVP")]
		private Label _lblVP;

		[CompilerGenerated]
		[AccessedThroughProperty("cmbVP")]
		private ComboBox _cmbVP;

		[CompilerGenerated]
		[AccessedThroughProperty("lblPrinterPrompt")]
		private Label _lblPrinterPrompt;

		[CompilerGenerated]
		[AccessedThroughProperty("lblPrinter")]
		private Label _lblPrinter;

		[CompilerGenerated]
		[AccessedThroughProperty("Panel1")]
		private Panel _Panel1;

		[CompilerGenerated]
		[AccessedThroughProperty("cmdEditPresets")]
		private Button _cmdEditPresets;

		[CompilerGenerated]
		[AccessedThroughProperty("GroupBoxPresets")]
		private GroupBox _GroupBoxPresets;

		[CompilerGenerated]
		[AccessedThroughProperty("cmbPresets")]
		private ComboBox _cmbPresets;

		[CompilerGenerated]
		[AccessedThroughProperty("GroupBoxChapters")]
		private GroupBox _GroupBoxChapters;

		[CompilerGenerated]
		[AccessedThroughProperty("optPresets")]
		private RadioButton _optPresets;

		[CompilerGenerated]
		[AccessedThroughProperty("optChapters")]
		private RadioButton _optChapters;

		[CompilerGenerated]
		[AccessedThroughProperty("optAllPresets")]
		private RadioButton _optAllPresets;

		[CompilerGenerated]
		[AccessedThroughProperty("chkShowMobiEpubSelect")]
		private CheckBox _chkShowMobiEpubSelect;

		[CompilerGenerated]
		[AccessedThroughProperty("fraMobiEpub")]
		private GroupBox _fraMobiEpub;

		[CompilerGenerated]
		[AccessedThroughProperty("cmdEditMobiEpub")]
		private Button _cmdEditMobiEpub;

		[CompilerGenerated]
		[AccessedThroughProperty("cmbExporters")]
		private ComboBox _cmbExporters;

		[CompilerGenerated]
		[AccessedThroughProperty("chkExportMobiFormat")]
		private CheckBox _chkExportMobiFormat;

		[CompilerGenerated]
		[AccessedThroughProperty("chkExportEpubFormat")]
		private CheckBox _chkExportEpubFormat;

		[CompilerGenerated]
		[AccessedThroughProperty("GroupBox1")]
		private GroupBox _GroupBox1;

		public bool Cancelled;

		public clsCollection<int> PickedIDs;

		public clsCollection<int> PickedScIDs;

		public string PickedFilename;

		public bool UsePreset;

		public bool UseAllPresets;

		public bool WithUnused;

		public bool RunCalibre;

		public string EbookProfileName;

		private int FirstFile;

		private int LastFile;

		public string Tags;

		public int VPID;

		private PrintDialog cP;

		private clsProject cProject;

		private int MobiExpID;

		private int EpubExpID;

		private int ExporterNameID;

		private int ExpEnabledID;

		public virtual Button cmdAll
		{
			[CompilerGenerated]
			get
			{
				return _cmdAll;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmdAll_Click;
				Button cmdAll = _cmdAll;
				if (cmdAll != null)
				{
					cmdAll.Click -= value2;
				}
				_cmdAll = value;
				cmdAll = _cmdAll;
				if (cmdAll != null)
				{
					cmdAll.Click += value2;
				}
			}
		}

		public virtual Button cmdCancel
		{
			[CompilerGenerated]
			get
			{
				return _cmdCancel;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmdCancel_Click;
				Button cmdCancel = _cmdCancel;
				if (cmdCancel != null)
				{
					cmdCancel.Click -= value2;
				}
				_cmdCancel = value;
				cmdCancel = _cmdCancel;
				if (cmdCancel != null)
				{
					cmdCancel.Click += value2;
				}
			}
		}

		public virtual Button cmdOk
		{
			[CompilerGenerated]
			get
			{
				return _cmdOk;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmdOK_Click;
				Button cmdOk = _cmdOk;
				if (cmdOk != null)
				{
					cmdOk.Click -= value2;
				}
				_cmdOk = value;
				cmdOk = _cmdOk;
				if (cmdOk != null)
				{
					cmdOk.Click += value2;
				}
			}
		}

		[field: AccessedThroughProperty("cmbLastChapter")]
		public virtual ComboBox cmbLastChapter
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("cmbFirstChapter")]
		public virtual ComboBox cmbFirstChapter
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("Label2")]
		public virtual Label Label2
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("Label1")]
		public virtual Label Label1
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		internal virtual CheckBox chkUnused
		{
			[CompilerGenerated]
			get
			{
				return _chkUnused;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = chkUnused_CheckedChanged;
				CheckBox chkUnused = _chkUnused;
				if (chkUnused != null)
				{
					chkUnused.CheckedChanged -= value2;
				}
				_chkUnused = value;
				chkUnused = _chkUnused;
				if (chkUnused != null)
				{
					chkUnused.CheckedChanged += value2;
				}
			}
		}

		[field: AccessedThroughProperty("lblTags")]
		public virtual Label lblTags
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("txtTags")]
		internal virtual TextBox txtTags
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("lblVP")]
		public virtual Label lblVP
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("cmbVP")]
		internal virtual ComboBox cmbVP
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("lblPrinterPrompt")]
		public virtual Label lblPrinterPrompt
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		public virtual Label lblPrinter
		{
			[CompilerGenerated]
			get
			{
				return _lblPrinter;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = lblPrinter_Click;
				Label lblPrinter = _lblPrinter;
				if (lblPrinter != null)
				{
					lblPrinter.Click -= value2;
				}
				_lblPrinter = value;
				lblPrinter = _lblPrinter;
				if (lblPrinter != null)
				{
					lblPrinter.Click += value2;
				}
			}
		}

		internal virtual Panel Panel1
		{
			[CompilerGenerated]
			get
			{
				return _Panel1;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				PaintEventHandler value2 = Panel1_Paint;
				Panel panel = _Panel1;
				if (panel != null)
				{
					panel.Paint -= value2;
				}
				_Panel1 = value;
				panel = _Panel1;
				if (panel != null)
				{
					panel.Paint += value2;
				}
			}
		}

		public virtual Button cmdEditPresets
		{
			[CompilerGenerated]
			get
			{
				return _cmdEditPresets;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmdEditPresets_Click;
				Button cmdEditPresets = _cmdEditPresets;
				if (cmdEditPresets != null)
				{
					cmdEditPresets.Click -= value2;
				}
				_cmdEditPresets = value;
				cmdEditPresets = _cmdEditPresets;
				if (cmdEditPresets != null)
				{
					cmdEditPresets.Click += value2;
				}
			}
		}

		[field: AccessedThroughProperty("GroupBoxPresets")]
		internal virtual GroupBox GroupBoxPresets
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		public virtual ComboBox cmbPresets
		{
			[CompilerGenerated]
			get
			{
				return _cmbPresets;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmbPresets_SelectedIndexChanged;
				ComboBox cmbPresets = _cmbPresets;
				if (cmbPresets != null)
				{
					cmbPresets.SelectedIndexChanged -= value2;
				}
				_cmbPresets = value;
				cmbPresets = _cmbPresets;
				if (cmbPresets != null)
				{
					cmbPresets.SelectedIndexChanged += value2;
				}
			}
		}

		[field: AccessedThroughProperty("GroupBoxChapters")]
		internal virtual GroupBox GroupBoxChapters
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		internal virtual RadioButton optPresets
		{
			[CompilerGenerated]
			get
			{
				return _optPresets;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = optPresets_CheckedChanged;
				RadioButton optPresets = _optPresets;
				if (optPresets != null)
				{
					optPresets.CheckedChanged -= value2;
				}
				_optPresets = value;
				optPresets = _optPresets;
				if (optPresets != null)
				{
					optPresets.CheckedChanged += value2;
				}
			}
		}

		internal virtual RadioButton optChapters
		{
			[CompilerGenerated]
			get
			{
				return _optChapters;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = optChapters_CheckedChanged;
				RadioButton optChapters = _optChapters;
				if (optChapters != null)
				{
					optChapters.CheckedChanged -= value2;
				}
				_optChapters = value;
				optChapters = _optChapters;
				if (optChapters != null)
				{
					optChapters.CheckedChanged += value2;
				}
			}
		}

		internal virtual RadioButton optAllPresets
		{
			[CompilerGenerated]
			get
			{
				return _optAllPresets;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = optAllPresets_CheckedChanged;
				RadioButton optAllPresets = _optAllPresets;
				if (optAllPresets != null)
				{
					optAllPresets.CheckedChanged -= value2;
				}
				_optAllPresets = value;
				optAllPresets = _optAllPresets;
				if (optAllPresets != null)
				{
					optAllPresets.CheckedChanged += value2;
				}
			}
		}

		internal virtual CheckBox chkShowMobiEpubSelect
		{
			[CompilerGenerated]
			get
			{
				return _chkShowMobiEpubSelect;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = chkMobiEpub_CheckedChanged;
				CheckBox chkShowMobiEpubSelect = _chkShowMobiEpubSelect;
				if (chkShowMobiEpubSelect != null)
				{
					chkShowMobiEpubSelect.CheckedChanged -= value2;
				}
				_chkShowMobiEpubSelect = value;
				chkShowMobiEpubSelect = _chkShowMobiEpubSelect;
				if (chkShowMobiEpubSelect != null)
				{
					chkShowMobiEpubSelect.CheckedChanged += value2;
				}
			}
		}

		[field: AccessedThroughProperty("fraMobiEpub")]
		internal virtual GroupBox fraMobiEpub
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		internal virtual Button cmdEditMobiEpub
		{
			[CompilerGenerated]
			get
			{
				return _cmdEditMobiEpub;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmdEditMobiEpub_Click;
				Button cmdEditMobiEpub = _cmdEditMobiEpub;
				if (cmdEditMobiEpub != null)
				{
					cmdEditMobiEpub.Click -= value2;
				}
				_cmdEditMobiEpub = value;
				cmdEditMobiEpub = _cmdEditMobiEpub;
				if (cmdEditMobiEpub != null)
				{
					cmdEditMobiEpub.Click += value2;
				}
			}
		}

		internal virtual ComboBox cmbExporters
		{
			[CompilerGenerated]
			get
			{
				return _cmbExporters;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = cmbExporters_SelectedIndexChanged;
				ComboBox cmbExporters = _cmbExporters;
				if (cmbExporters != null)
				{
					cmbExporters.SelectedIndexChanged -= value2;
				}
				_cmbExporters = value;
				cmbExporters = _cmbExporters;
				if (cmbExporters != null)
				{
					cmbExporters.SelectedIndexChanged += value2;
				}
			}
		}

		[field: AccessedThroughProperty("chkExportMobiFormat")]
		internal virtual CheckBox chkExportMobiFormat
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("chkExportEpubFormat")]
		internal virtual CheckBox chkExportEpubFormat
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[field: AccessedThroughProperty("GroupBox1")]
		internal virtual GroupBox GroupBox1
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		public PrinterSettings PrintSettings => cP.PrinterSettings;

		[DebuggerNonUserCode]
		protected override void Dispose(bool Disposing)
		{
			if (Disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(Disposing);
		}

		[System.Diagnostics.DebuggerStepThrough]
		private void InitializeComponent()
		{
			components = new System.ComponentModel.Container();
			ToolTip1 = new System.Windows.Forms.ToolTip(components);
			cmdAll = new System.Windows.Forms.Button();
			cmdOk = new System.Windows.Forms.Button();
			txtTags = new System.Windows.Forms.TextBox();
			cmdCancel = new System.Windows.Forms.Button();
			cmbLastChapter = new System.Windows.Forms.ComboBox();
			cmbFirstChapter = new System.Windows.Forms.ComboBox();
			Label2 = new System.Windows.Forms.Label();
			Label1 = new System.Windows.Forms.Label();
			chkUnused = new System.Windows.Forms.CheckBox();
			lblTags = new System.Windows.Forms.Label();
			lblVP = new System.Windows.Forms.Label();
			cmbVP = new System.Windows.Forms.ComboBox();
			lblPrinterPrompt = new System.Windows.Forms.Label();
			lblPrinter = new System.Windows.Forms.Label();
			Panel1 = new System.Windows.Forms.Panel();
			GroupBox1 = new System.Windows.Forms.GroupBox();
			optAllPresets = new System.Windows.Forms.RadioButton();
			optPresets = new System.Windows.Forms.RadioButton();
			optChapters = new System.Windows.Forms.RadioButton();
			GroupBoxPresets = new System.Windows.Forms.GroupBox();
			cmdEditPresets = new System.Windows.Forms.Button();
			cmbPresets = new System.Windows.Forms.ComboBox();
			GroupBoxChapters = new System.Windows.Forms.GroupBox();
			chkShowMobiEpubSelect = new System.Windows.Forms.CheckBox();
			fraMobiEpub = new System.Windows.Forms.GroupBox();
			cmdEditMobiEpub = new System.Windows.Forms.Button();
			cmbExporters = new System.Windows.Forms.ComboBox();
			chkExportMobiFormat = new System.Windows.Forms.CheckBox();
			chkExportEpubFormat = new System.Windows.Forms.CheckBox();
			Panel1.SuspendLayout();
			GroupBox1.SuspendLayout();
			GroupBoxPresets.SuspendLayout();
			GroupBoxChapters.SuspendLayout();
			fraMobiEpub.SuspendLayout();
			SuspendLayout();
			cmdAll.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
			cmdAll.AutoSize = true;
			cmdAll.BackColor = System.Drawing.SystemColors.Control;
			cmdAll.Cursor = System.Windows.Forms.Cursors.Default;
			cmdAll.Font = new System.Drawing.Font("Segoe UI", 10f);
			cmdAll.ForeColor = System.Drawing.SystemColors.ControlText;
			cmdAll.Location = new System.Drawing.Point(377, 540);
			cmdAll.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmdAll.Name = "cmdAll";
			cmdAll.RightToLeft = System.Windows.Forms.RightToLeft.No;
			cmdAll.Size = new System.Drawing.Size(82, 45);
			cmdAll.TabIndex = 6;
			cmdAll.Text = "All";
			ToolTip1.SetToolTip(cmdAll, "Select all files");
			cmdAll.UseVisualStyleBackColor = true;
			cmdOk.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
			cmdOk.AutoSize = true;
			cmdOk.BackColor = System.Drawing.SystemColors.Control;
			cmdOk.Cursor = System.Windows.Forms.Cursors.Default;
			cmdOk.DialogResult = System.Windows.Forms.DialogResult.OK;
			cmdOk.Font = new System.Drawing.Font("Segoe UI", 10f);
			cmdOk.ForeColor = System.Drawing.SystemColors.ControlText;
			cmdOk.Location = new System.Drawing.Point(486, 540);
			cmdOk.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmdOk.Name = "cmdOk";
			cmdOk.RightToLeft = System.Windows.Forms.RightToLeft.No;
			cmdOk.Size = new System.Drawing.Size(82, 45);
			cmdOk.TabIndex = 4;
			cmdOk.Text = "OK";
			ToolTip1.SetToolTip(cmdOk, "Use the chosen range of files");
			cmdOk.UseVisualStyleBackColor = true;
			txtTags.Location = new System.Drawing.Point(109, 56);
			txtTags.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			txtTags.Name = "txtTags";
			txtTags.Size = new System.Drawing.Size(301, 25);
			txtTags.TabIndex = 8;
			ToolTip1.SetToolTip(txtTags, "Only prints scenes with these tags");
			txtTags.Visible = false;
			cmdCancel.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);
			cmdCancel.AutoSize = true;
			cmdCancel.BackColor = System.Drawing.SystemColors.Control;
			cmdCancel.Cursor = System.Windows.Forms.Cursors.Default;
			cmdCancel.Font = new System.Drawing.Font("Segoe UI", 10f);
			cmdCancel.ForeColor = System.Drawing.SystemColors.ControlText;
			cmdCancel.Location = new System.Drawing.Point(12, 540);
			cmdCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmdCancel.Name = "cmdCancel";
			cmdCancel.RightToLeft = System.Windows.Forms.RightToLeft.No;
			cmdCancel.Size = new System.Drawing.Size(87, 45);
			cmdCancel.TabIndex = 5;
			cmdCancel.Text = "Cancel";
			cmdCancel.UseVisualStyleBackColor = true;
			cmbLastChapter.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
			cmbLastChapter.BackColor = System.Drawing.SystemColors.Window;
			cmbLastChapter.Cursor = System.Windows.Forms.Cursors.Default;
			cmbLastChapter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			cmbLastChapter.Font = new System.Drawing.Font("Arial", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
			cmbLastChapter.ForeColor = System.Drawing.SystemColors.WindowText;
			cmbLastChapter.Location = new System.Drawing.Point(114, 57);
			cmbLastChapter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmbLastChapter.Name = "cmbLastChapter";
			cmbLastChapter.RightToLeft = System.Windows.Forms.RightToLeft.No;
			cmbLastChapter.Size = new System.Drawing.Size(310, 22);
			cmbLastChapter.TabIndex = 1;
			cmbFirstChapter.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
			cmbFirstChapter.BackColor = System.Drawing.SystemColors.Window;
			cmbFirstChapter.Cursor = System.Windows.Forms.Cursors.Default;
			cmbFirstChapter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			cmbFirstChapter.Font = new System.Drawing.Font("Arial", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
			cmbFirstChapter.ForeColor = System.Drawing.SystemColors.WindowText;
			cmbFirstChapter.Location = new System.Drawing.Point(114, 27);
			cmbFirstChapter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmbFirstChapter.Name = "cmbFirstChapter";
			cmbFirstChapter.RightToLeft = System.Windows.Forms.RightToLeft.No;
			cmbFirstChapter.Size = new System.Drawing.Size(310, 22);
			cmbFirstChapter.TabIndex = 0;
			Label2.AutoSize = true;
			Label2.BackColor = System.Drawing.SystemColors.Control;
			Label2.Cursor = System.Windows.Forms.Cursors.Default;
			Label2.Font = new System.Drawing.Font("Segoe UI", 10f);
			Label2.ForeColor = System.Drawing.SystemColors.ControlText;
			Label2.Location = new System.Drawing.Point(46, 57);
			Label2.Name = "Label2";
			Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			Label2.Size = new System.Drawing.Size(61, 19);
			Label2.TabIndex = 3;
			Label2.Text = "Last File:";
			Label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
			Label1.AutoSize = true;
			Label1.BackColor = System.Drawing.SystemColors.Control;
			Label1.Cursor = System.Windows.Forms.Cursors.Default;
			Label1.Font = new System.Drawing.Font("Segoe UI", 10f);
			Label1.ForeColor = System.Drawing.SystemColors.ControlText;
			Label1.Location = new System.Drawing.Point(52, 27);
			Label1.Name = "Label1";
			Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			Label1.Size = new System.Drawing.Size(55, 19);
			Label1.TabIndex = 2;
			Label1.Text = "1st File:";
			Label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
			chkUnused.AutoSize = true;
			chkUnused.Location = new System.Drawing.Point(109, 25);
			chkUnused.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			chkUnused.Name = "chkUnused";
			chkUnused.Size = new System.Drawing.Size(222, 23);
			chkUnused.TabIndex = 7;
			chkUnused.Text = "Include unused chapters/scenes";
			chkUnused.UseVisualStyleBackColor = true;
			lblTags.AutoSize = true;
			lblTags.BackColor = System.Drawing.SystemColors.Control;
			lblTags.Cursor = System.Windows.Forms.Cursors.Default;
			lblTags.Font = new System.Drawing.Font("Segoe UI", 10f);
			lblTags.ForeColor = System.Drawing.SystemColors.ControlText;
			lblTags.Location = new System.Drawing.Point(65, 59);
			lblTags.Name = "lblTags";
			lblTags.RightToLeft = System.Windows.Forms.RightToLeft.No;
			lblTags.Size = new System.Drawing.Size(38, 19);
			lblTags.TabIndex = 3;
			lblTags.Text = "Tags:";
			lblTags.TextAlign = System.Drawing.ContentAlignment.TopRight;
			lblTags.Visible = false;
			lblVP.AutoSize = true;
			lblVP.BackColor = System.Drawing.SystemColors.Control;
			lblVP.Cursor = System.Windows.Forms.Cursors.Default;
			lblVP.Font = new System.Drawing.Font("Segoe UI", 10f);
			lblVP.ForeColor = System.Drawing.SystemColors.ControlText;
			lblVP.Location = new System.Drawing.Point(30, 92);
			lblVP.Name = "lblVP";
			lblVP.RightToLeft = System.Windows.Forms.RightToLeft.No;
			lblVP.Size = new System.Drawing.Size(73, 19);
			lblVP.TabIndex = 3;
			lblVP.Text = "Viewpoint:";
			lblVP.TextAlign = System.Drawing.ContentAlignment.TopRight;
			lblVP.Visible = false;
			cmbVP.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			cmbVP.FormattingEnabled = true;
			cmbVP.Location = new System.Drawing.Point(109, 89);
			cmbVP.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmbVP.Name = "cmbVP";
			cmbVP.Size = new System.Drawing.Size(301, 25);
			cmbVP.TabIndex = 9;
			cmbVP.Visible = false;
			lblPrinterPrompt.AutoSize = true;
			lblPrinterPrompt.BackColor = System.Drawing.SystemColors.Control;
			lblPrinterPrompt.Cursor = System.Windows.Forms.Cursors.Default;
			lblPrinterPrompt.Font = new System.Drawing.Font("Segoe UI", 10f);
			lblPrinterPrompt.ForeColor = System.Drawing.SystemColors.ControlText;
			lblPrinterPrompt.Location = new System.Drawing.Point(48, 127);
			lblPrinterPrompt.Name = "lblPrinterPrompt";
			lblPrinterPrompt.RightToLeft = System.Windows.Forms.RightToLeft.No;
			lblPrinterPrompt.Size = new System.Drawing.Size(53, 19);
			lblPrinterPrompt.TabIndex = 3;
			lblPrinterPrompt.Text = "Printer:";
			lblPrinterPrompt.TextAlign = System.Drawing.ContentAlignment.TopRight;
			lblPrinterPrompt.Visible = false;
			lblPrinter.BackColor = System.Drawing.SystemColors.Window;
			lblPrinter.Cursor = System.Windows.Forms.Cursors.Default;
			lblPrinter.Font = new System.Drawing.Font("Arial", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
			lblPrinter.ForeColor = System.Drawing.SystemColors.ControlText;
			lblPrinter.Location = new System.Drawing.Point(107, 127);
			lblPrinter.Name = "lblPrinter";
			lblPrinter.RightToLeft = System.Windows.Forms.RightToLeft.No;
			lblPrinter.Size = new System.Drawing.Size(306, 23);
			lblPrinter.TabIndex = 3;
			lblPrinter.Visible = false;
			Panel1.Controls.Add(GroupBox1);
			Panel1.Controls.Add(optAllPresets);
			Panel1.Controls.Add(optPresets);
			Panel1.Controls.Add(optChapters);
			Panel1.Controls.Add(GroupBoxPresets);
			Panel1.Controls.Add(GroupBoxChapters);
			Panel1.Location = new System.Drawing.Point(14, 15);
			Panel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			Panel1.Name = "Panel1";
			Panel1.Size = new System.Drawing.Size(554, 512);
			Panel1.TabIndex = 12;
			GroupBox1.Controls.Add(chkUnused);
			GroupBox1.Controls.Add(lblPrinter);
			GroupBox1.Controls.Add(lblPrinterPrompt);
			GroupBox1.Controls.Add(txtTags);
			GroupBox1.Controls.Add(lblVP);
			GroupBox1.Controls.Add(cmbVP);
			GroupBox1.Controls.Add(lblTags);
			GroupBox1.Location = new System.Drawing.Point(27, 333);
			GroupBox1.Name = "GroupBox1";
			GroupBox1.Size = new System.Drawing.Size(506, 164);
			GroupBox1.TabIndex = 14;
			GroupBox1.TabStop = false;
			GroupBox1.Text = "Common to all exports";
			optAllPresets.AutoSize = true;
			optAllPresets.Location = new System.Drawing.Point(13, 291);
			optAllPresets.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			optAllPresets.Name = "optAllPresets";
			optAllPresets.Size = new System.Drawing.Size(412, 23);
			optAllPresets.TabIndex = 13;
			optAllPresets.Text = "All Presets (Please ensure you've set a filename for each preset)";
			optAllPresets.UseVisualStyleBackColor = true;
			optAllPresets.Visible = false;
			optPresets.AutoSize = true;
			optPresets.Location = new System.Drawing.Point(13, 223);
			optPresets.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			optPresets.Name = "optPresets";
			optPresets.Size = new System.Drawing.Size(71, 23);
			optPresets.TabIndex = 13;
			optPresets.Text = "Presets";
			optPresets.UseVisualStyleBackColor = true;
			optChapters.AutoSize = true;
			optChapters.Checked = true;
			optChapters.Location = new System.Drawing.Point(13, 16);
			optChapters.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			optChapters.Name = "optChapters";
			optChapters.Size = new System.Drawing.Size(82, 23);
			optChapters.TabIndex = 13;
			optChapters.TabStop = true;
			optChapters.Text = "Chapters";
			optChapters.UseVisualStyleBackColor = true;
			GroupBoxPresets.Controls.Add(cmdEditPresets);
			GroupBoxPresets.Controls.Add(cmbPresets);
			GroupBoxPresets.Location = new System.Drawing.Point(131, 213);
			GroupBoxPresets.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			GroupBoxPresets.Name = "GroupBoxPresets";
			GroupBoxPresets.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
			GroupBoxPresets.Size = new System.Drawing.Size(402, 70);
			GroupBoxPresets.TabIndex = 12;
			GroupBoxPresets.TabStop = false;
			GroupBoxPresets.Text = "Select a preset";
			GroupBoxPresets.Visible = false;
			cmdEditPresets.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
			cmdEditPresets.BackColor = System.Drawing.SystemColors.Control;
			cmdEditPresets.Cursor = System.Windows.Forms.Cursors.Default;
			cmdEditPresets.FlatStyle = System.Windows.Forms.FlatStyle.System;
			cmdEditPresets.Font = new System.Drawing.Font("Segoe UI", 10f);
			cmdEditPresets.ForeColor = System.Drawing.SystemColors.ControlText;
			cmdEditPresets.Location = new System.Drawing.Point(328, 21);
			cmdEditPresets.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmdEditPresets.Name = "cmdEditPresets";
			cmdEditPresets.RightToLeft = System.Windows.Forms.RightToLeft.No;
			cmdEditPresets.Size = new System.Drawing.Size(66, 29);
			cmdEditPresets.TabIndex = 6;
			cmdEditPresets.Text = "Edit";
			cmdEditPresets.UseVisualStyleBackColor = true;
			cmbPresets.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
			cmbPresets.BackColor = System.Drawing.SystemColors.Window;
			cmbPresets.Cursor = System.Windows.Forms.Cursors.Default;
			cmbPresets.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			cmbPresets.Font = new System.Drawing.Font("Arial", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
			cmbPresets.ForeColor = System.Drawing.SystemColors.WindowText;
			cmbPresets.Location = new System.Drawing.Point(20, 27);
			cmbPresets.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			cmbPresets.Name = "cmbPresets";
			cmbPresets.RightToLeft = System.Windows.Forms.RightToLeft.No;
			cmbPresets.Size = new System.Drawing.Size(291, 22);
			cmbPresets.TabIndex = 1;
			GroupBoxChapters.Controls.Add(chkShowMobiEpubSelect);
			GroupBoxChapters.Controls.Add(Label1);
			GroupBoxChapters.Controls.Add(fraMobiEpub);
			GroupBoxChapters.Controls.Add(cmbLastChapter);
			GroupBoxChapters.Controls.Add(cmbFirstChapter);
			GroupBoxChapters.Controls.Add(Label2);
			GroupBoxChapters.Location = new System.Drawing.Point(101, 16);
			GroupBoxChapters.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			GroupBoxChapters.Name = "GroupBoxChapters";
			GroupBoxChapters.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
			GroupBoxChapters.Size = new System.Drawing.Size(432, 179);
			GroupBoxChapters.TabIndex = 11;
			GroupBoxChapters.TabStop = false;
			GroupBoxChapters.Text = "Chapters";
			chkShowMobiEpubSelect.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
			chkShowMobiEpubSelect.Location = new System.Drawing.Point(9, 101);
			chkShowMobiEpubSelect.Name = "chkShowMobiEpubSelect";
			chkShowMobiEpubSelect.Size = new System.Drawing.Size(126, 64);
			chkShowMobiEpubSelect.TabIndex = 15;
			chkShowMobiEpubSelect.Text = "Create Mobi/Epub";
			chkShowMobiEpubSelect.UseVisualStyleBackColor = true;
			chkShowMobiEpubSelect.Visible = false;
			fraMobiEpub.Controls.Add(cmdEditMobiEpub);
			fraMobiEpub.Controls.Add(cmbExporters);
			fraMobiEpub.Controls.Add(chkExportMobiFormat);
			fraMobiEpub.Controls.Add(chkExportEpubFormat);
			fraMobiEpub.Location = new System.Drawing.Point(141, 86);
			fraMobiEpub.Name = "fraMobiEpub";
			fraMobiEpub.Size = new System.Drawing.Size(283, 85);
			fraMobiEpub.TabIndex = 14;
			fraMobiEpub.TabStop = false;
			fraMobiEpub.Visible = false;
			cmdEditMobiEpub.FlatStyle = System.Windows.Forms.FlatStyle.System;
			cmdEditMobiEpub.Location = new System.Drawing.Point(211, 18);
			cmdEditMobiEpub.Name = "cmdEditMobiEpub";
			cmdEditMobiEpub.Size = new System.Drawing.Size(66, 26);
			cmdEditMobiEpub.TabIndex = 6;
			cmdEditMobiEpub.Text = "Edit";
			cmdEditMobiEpub.UseVisualStyleBackColor = true;
			cmbExporters.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			cmbExporters.FormattingEnabled = true;
			cmbExporters.Location = new System.Drawing.Point(6, 18);
			cmbExporters.Name = "cmbExporters";
			cmbExporters.Size = new System.Drawing.Size(187, 25);
			cmbExporters.TabIndex = 5;
			chkExportMobiFormat.AutoSize = true;
			chkExportMobiFormat.Checked = true;
			chkExportMobiFormat.CheckState = System.Windows.Forms.CheckState.Checked;
			chkExportMobiFormat.Location = new System.Drawing.Point(6, 56);
			chkExportMobiFormat.Name = "chkExportMobiFormat";
			chkExportMobiFormat.Size = new System.Drawing.Size(120, 23);
			chkExportMobiFormat.TabIndex = 4;
			chkExportMobiFormat.Text = "Export to Mobi";
			chkExportMobiFormat.UseVisualStyleBackColor = true;
			chkExportEpubFormat.AutoSize = true;
			chkExportEpubFormat.Checked = true;
			chkExportEpubFormat.CheckState = System.Windows.Forms.CheckState.Checked;
			chkExportEpubFormat.Location = new System.Drawing.Point(149, 56);
			chkExportEpubFormat.Name = "chkExportEpubFormat";
			chkExportEpubFormat.Size = new System.Drawing.Size(119, 23);
			chkExportEpubFormat.TabIndex = 3;
			chkExportEpubFormat.Text = "Export to Epub";
			chkExportEpubFormat.UseVisualStyleBackColor = true;
			base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 17f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			BackColor = System.Drawing.SystemColors.Control;
			base.ClientSize = new System.Drawing.Size(586, 598);
			base.Controls.Add(Panel1);
			base.Controls.Add(cmdAll);
			base.Controls.Add(cmdCancel);
			base.Controls.Add(cmdOk);
			Cursor = System.Windows.Forms.Cursors.Default;
			DoubleBuffered = true;
			Font = new System.Drawing.Font("Segoe UI", 10f);
			base.Location = new System.Drawing.Point(3, 22);
			base.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
			MinimumSize = new System.Drawing.Size(602, 537);
			base.Name = "frmPickChapters";
			RightToLeft = System.Windows.Forms.RightToLeft.No;
			base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			Text = "Select the range of files";
			Panel1.ResumeLayout(false);
			Panel1.PerformLayout();
			GroupBox1.ResumeLayout(false);
			GroupBox1.PerformLayout();
			GroupBoxPresets.ResumeLayout(false);
			GroupBoxChapters.ResumeLayout(false);
			GroupBoxChapters.PerformLayout();
			fraMobiEpub.ResumeLayout(false);
			fraMobiEpub.PerformLayout();
			ResumeLayout(false);
			PerformLayout();
		}

		public void EnableTagFilter()
		{
			lblTags.Visible = true;
			txtTags.Visible = true;
		}

		public void HideTagFilter()
		{
			lblTags.Visible = false;
			txtTags.Visible = false;
		}

		public void EnableVPFilter()
		{
			lblVP.Visible = true;
			cmbVP.Visible = true;
		}

		public void EnableAllPresets()
		{
			optAllPresets.Visible = true;
		}

		public void HideVPFilter()
		{
			lblVP.Visible = false;
			cmbVP.Visible = false;
		}

		public void EnablePrinterSelect()
		{
			lblPrinter.Visible = true;
			lblPrinterPrompt.Visible = true;
		}

		public void HidePrinterSelect()
		{
			lblPrinter.Visible = false;
			lblPrinterPrompt.Visible = false;
		}

		public void HideMobiEpubSelect()
		{
			chkShowMobiEpubSelect.Visible = false;
		}

		public void EnableMobiEpubSelect()
		{
			chkShowMobiEpubSelect.Visible = true;
			InitChapterExporter();
		}

		public frmPickChapters(ref clsProject ProjectClass)
		{
			base.Load += frmPickChapters_Load;
			base.FormClosing += frmPickChapters_FormClosing;
			PickedIDs = new clsCollection<int>();
			PickedScIDs = new clsCollection<int>();
			PickedFilename = "";
			WithUnused = false;
			RunCalibre = false;
			EbookProfileName = "";
			Tags = "";
			VPID = 0;
			cP = new PrintDialog();
			InitializeComponent();
			cProject = ProjectClass;
			FillFiles();
			FillVP();
			DisplayPrinter();
		}

		private void cmdAll_Click(object eventSender, EventArgs eventArgs)
		{
			SaveChapterExporter();
			cmbFirstChapter.SelectedIndex = 0;
			cmbLastChapter.SelectedIndex = cmbLastChapter.Items.Count - 1;
			FirstFile = 1;
			LastFile = cmbLastChapter.Items.Count;
			WithUnused = chkUnused.Checked;
			PickedFilename = "";
			UsePreset = false;
			UseAllPresets = false;
			FillSelectedIDs();
			Tags = txtTags.Text;
			Cancelled = false;
			Hide();
		}

		private void cmdCancel_Click(object eventSender, EventArgs eventArgs)
		{
			Cancelled = true;
			Hide();
			PickedFilename = "";
		}

		private void cmdOK_Click(object eventSender, EventArgs eventArgs)
		{
			SaveChapterExporter();
			WithUnused = chkUnused.Checked;
			if (optPresets.Checked)
			{
				UsePreset = true;
				UseAllPresets = false;
				SetPreset(cmbPresets.Text);
			}
			else if (optAllPresets.Checked)
			{
				UsePreset = true;
				UseAllPresets = true;
			}
			else
			{
				PickedFilename = "";
				UsePreset = false;
				UseAllPresets = false;
				FirstFile = cmbFirstChapter.SelectedIndex + 1;
				LastFile = cmbLastChapter.SelectedIndex + 1;
				RunCalibre = chkShowMobiEpubSelect.Checked;
				if (RunCalibre)
				{
					if (Operators.CompareString(cmbExporters.Text, "", TextCompare: false) == 0)
					{
						Interaction.MsgBox("Please select an ebook exporter before trying to create mobi/epub files.");
						RunCalibre = false;
					}
					else
					{
						EbookProfileName = cmbExporters.Text;
					}
				}
				FillSelectedIDs();
			}
			if (LastFile < FirstFile)
			{
				clsShared.cLang.TransMsgBox("Last file must come after first file. Please change one or the other.");
				return;
			}
			Tags = txtTags.Text;
			VPID = ((clsCharacter)cmbVP.SelectedItem).ID;
			Cancelled = false;
			Hide();
		}

		private void FillSelectedIDs()
		{
			PickedIDs.Clear();
			int firstFile = FirstFile;
			int lastFile = LastFile;
			for (int i = firstFile; i <= lastFile; i++)
			{
				string text = Conversions.ToString(cProject.Chapters.ChapterByIndex(i).ID);
				if (WithUnused | !cProject.get_ChapterByID(Conversions.ToInteger(text)).Unused)
				{
					PickedIDs.Add(Conversions.ToInteger(text), text);
				}
			}
		}

		private void frmPickChapters_Load(object eventSender, EventArgs eventArgs)
		{
			base.Icon = Resources.yWriter5_Ico;
			if (Operators.CompareString(clsShared.cLang.CurrentLanguage, "English", TextCompare: false) != 0)
			{
				clsShared.cLang.TranslateForm(this);
			}
			clsShared.cFormFont.SetFormFont(this, clsShared.cSettings.sGet("FormFont", modVariables.DefaultUIFont.Name), clsShared.cSettings.sGet("UIFontSize", modVariables.DefaultUIFont.Size));
		}

		private void FillFiles()
		{
			try
			{
				Cancelled = false;
				int num = 0;
				cmbFirstChapter.Items.Clear();
				cmbLastChapter.Items.Clear();
				IEnumerator enumerator = default(IEnumerator);
				try
				{
					enumerator = cProject.Chapters.GetEnumerator();
					while (enumerator.MoveNext())
					{
						clsChapter clsChapter = (clsChapter)enumerator.Current;
						num++;
						cmbFirstChapter.Items.Add(Conversions.ToString(num) + " - " + clsChapter.Title);
						cmbLastChapter.Items.Add(Conversions.ToString(num) + " - " + clsChapter.Title);
					}
				}
				finally
				{
					if (enumerator is IDisposable)
					{
						(enumerator as IDisposable).Dispose();
					}
				}
				if (cmbFirstChapter.Items.Count > 0)
				{
					cmbFirstChapter.SelectedIndex = 0;
					cmbLastChapter.SelectedIndex = cmbLastChapter.Items.Count - 1;
				}
				LoadPresets();
				clsProject clsProject = cProject;
				ComboBox cmbExporters = this.cmbExporters;
				clsEpub.FillExporterCombo(clsProject, ref cmbExporters, "");
				this.cmbExporters = cmbExporters;
				SetExporterIndex();
			}
			catch (Exception ex)
			{
				ProjectData.SetProjectError(ex);
				Exception ex2 = ex;
				clsShared.cLog.AddAction(ex2, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		private void SetExporterIndex()
		{
			if (ExporterNameID > 0)
			{
				string descText = ((clsGenericBase<clsVar>)cProject.cVars).get_ByID(ExporterNameID).DescText;
				ComboBox cmbExporters = this.cmbExporters;
				clsEpub.SetExporterIndex(descText, ref cmbExporters);
				this.cmbExporters = cmbExporters;
			}
		}

		private void FillVP()
		{
			cmbVP.Items.Clear();
			try
			{
				modScenesPerChar.UpdateScenesPerChar(cProject);
				cmbVP.DisplayMember = "Title";
				clsCharacter clsCharacter = new clsCharacter();
				clsCharacter.ID = -1;
				clsCharacter.Title = "All";
				cmbVP.Items.Add(clsCharacter);
				IEnumerator enumerator = default(IEnumerator);
				try
				{
					enumerator = cProject.Chars.GetEnumerator();
					while (enumerator.MoveNext())
					{
						clsCharacter = (clsCharacter)enumerator.Current;
						if (clsCharacter.VPSceneCount > 0)
						{
							cmbVP.Items.Add(clsCharacter);
						}
					}
				}
				finally
				{
					if (enumerator is IDisposable)
					{
						(enumerator as IDisposable).Dispose();
					}
				}
				cmbVP.SelectedIndex = 0;
			}
			catch (Exception ex)
			{
				ProjectData.SetProjectError(ex);
				Exception ex2 = ex;
				clsShared.cLog.AddAction(ex2, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		private void DisplayPrinter()
		{
			lblPrinter.Text = cP.PrinterSettings.PrinterName;
		}

		private void lblPrinter_Click(object sender, EventArgs e)
		{
			cP.ShowDialog();
			lblPrinter.Text = cP.PrinterSettings.PrinterName;
		}

		private void LoadPresets()
		{
			cmbPresets.Items.Clear();
			IEnumerator enumerator = default(IEnumerator);
			try
			{
				enumerator = cProject.cExports.GetEnumerator();
				while (enumerator.MoveNext())
				{
					clsExport clsExport = (clsExport)enumerator.Current;
					cmbPresets.Items.Add(clsExport.Title);
				}
			}
			finally
			{
				if (enumerator is IDisposable)
				{
					(enumerator as IDisposable).Dispose();
				}
			}
		}

		private void cmbPresets_SelectedIndexChanged(object sender, EventArgs e)
		{
		}

		private void optChapters_CheckedChanged(object sender, EventArgs e)
		{
			if (optChapters.Checked)
			{
				GroupBoxChapters.Visible = true;
				GroupBoxPresets.Visible = false;
			}
			else
			{
				GroupBoxChapters.Visible = false;
				GroupBoxPresets.Visible = true;
			}
		}

		private void optPresets_CheckedChanged(object sender, EventArgs e)
		{
			if (optPresets.Checked)
			{
				cmdAll.Visible = false;
				GroupBoxChapters.Visible = false;
				GroupBoxPresets.Visible = true;
			}
			else
			{
				cmdAll.Visible = true;
				GroupBoxChapters.Visible = true;
				GroupBoxPresets.Visible = false;
			}
		}

		private void cmdEditPresets_Click(object sender, EventArgs e)
		{
			frmPresets frmPresets = new frmPresets(ref cProject);
			frmPresets.SetCurrentFilter(cmbPresets.Text);
			frmPresets.ShowDialog();
			LoadPresets();
		}

		private void SetPreset(string Fileonly)
		{
			PickedIDs.Clear();
			int iD = cProject.cExports.IDByTitle(cmbPresets.Text);
			clsExport clsExport = ((clsGenericBase<clsExport>)cProject.cExports).get_ByID(iD);
			string[] aKAArray = clsExport.AKAArray;
			foreach (string text in aKAArray)
			{
				if (Operators.CompareString(text.Trim(), "", TextCompare: false) != 0 && (WithUnused | !cProject.get_ChapterByID(Conversions.ToInteger(text)).Unused))
				{
					PickedIDs.Add(Conversions.ToInteger(text), text);
				}
			}
			PickedFilename = clsExport.Filename;
			if (clsExport.ImageFile.Length > 0)
			{
				RunCalibre = true;
				EbookProfileName = clsExport.ImageFile;
			}
			else
			{
				RunCalibre = false;
				EbookProfileName = "";
			}
			if (clsExport.Tags.Contains("mobi"))
			{
				chkExportMobiFormat.Checked = true;
			}
			else
			{
				chkExportMobiFormat.Checked = false;
			}
			if (clsExport.Tags.Contains("epub"))
			{
				chkExportEpubFormat.Checked = true;
			}
			else
			{
				chkExportEpubFormat.Checked = false;
			}
		}

		private void chkUnused_CheckedChanged(object sender, EventArgs e)
		{
		}

		private void optAllPresets_CheckedChanged(object sender, EventArgs e)
		{
			if (optAllPresets.Checked)
			{
				GroupBoxChapters.Visible = false;
				cmdAll.Visible = false;
				GroupBoxPresets.Visible = false;
			}
		}

		private void chkMobiEpub_CheckedChanged(object sender, EventArgs e)
		{
			fraMobiEpub.Visible = chkShowMobiEpubSelect.Checked;
		}

		private void cmdEditMobiEpub_Click(object sender, EventArgs e)
		{
			try
			{
				string text = this.cmbExporters.Text;
				new frmMobiEpub(ref cProject).ShowDialog();
				clsProject clsProject = cProject;
				ComboBox cmbExporters = this.cmbExporters;
				clsEpub.FillExporterCombo(clsProject, ref cmbExporters, text);
				this.cmbExporters = cmbExporters;
			}
			catch (Exception ex)
			{
				ProjectData.SetProjectError(ex);
				Exception ex2 = ex;
				clsShared.cLog.AddAction(ex2, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		private void InitChapterExporter()
		{
			try
			{
				IEnumerator enumerator = default(IEnumerator);
				try
				{
					enumerator = cProject.cVars.GetEnumerator();
					while (enumerator.MoveNext())
					{
						clsVar clsVar = (clsVar)enumerator.Current;
						if (Operators.CompareString(clsVar.Title, "MobiExport", TextCompare: false) == 0)
						{
							if (Operators.CompareString(clsVar.DescText, "1", TextCompare: false) == 0)
							{
								chkExportMobiFormat.Checked = true;
							}
							MobiExpID = clsVar.ID;
						}
						else if (Operators.CompareString(clsVar.Title, "EpubExport", TextCompare: false) == 0)
						{
							if (Operators.CompareString(clsVar.DescText, "1", TextCompare: false) == 0)
							{
								chkExportEpubFormat.Checked = true;
							}
							EpubExpID = clsVar.ID;
						}
						else if (Operators.CompareString(clsVar.Title, "MobiEpubEnabled", TextCompare: false) == 0)
						{
							if (Operators.CompareString(clsVar.DescText, "1", TextCompare: false) == 0)
							{
								chkShowMobiEpubSelect.Checked = true;
							}
							ExpEnabledID = clsVar.ID;
						}
						else if (Operators.CompareString(clsVar.Title, "ExporterName", TextCompare: false) == 0)
						{
							ExporterNameID = clsVar.ID;
							SetExporterIndex();
						}
					}
				}
				finally
				{
					if (enumerator is IDisposable)
					{
						(enumerator as IDisposable).Dispose();
					}
				}
			}
			catch (Exception ex)
			{
				ProjectData.SetProjectError(ex);
				Exception ex2 = ex;
				clsShared.cLog.AddAction(ex2, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		private void SaveChapterExporter()
		{
			try
			{
				clsVar cObject = ((clsGenericBase<clsVar>)cProject.cVars).get_ByID(ExpEnabledID);
				if (chkShowMobiEpubSelect.Checked)
				{
					cObject.DescText = "1";
				}
				else
				{
					cObject.DescText = "0";
				}
				cObject.Title = "MobiEpubEnabled";
				cProject.cVars.RemoveByName(cObject.Title);
				cProject.cVars.Added(ref cObject);
				cObject = ((clsGenericBase<clsVar>)cProject.cVars).get_ByID(MobiExpID);
				if (chkExportMobiFormat.Checked)
				{
					cObject.DescText = "1";
				}
				else
				{
					cObject.DescText = "0";
				}
				cObject.Title = "MobiExport";
				cProject.cVars.RemoveByName(cObject.Title);
				cProject.cVars.Added(ref cObject);
				cObject = ((clsGenericBase<clsVar>)cProject.cVars).get_ByID(EpubExpID);
				if (chkExportEpubFormat.Checked)
				{
					cObject.DescText = "1";
				}
				else
				{
					cObject.DescText = "0";
				}
				cObject.Title = "EpubExport";
				cProject.cVars.RemoveByName(cObject.Title);
				cProject.cVars.Added(ref cObject);
				cObject = ((clsGenericBase<clsVar>)cProject.cVars).get_ByID(ExporterNameID);
				cObject.DescText = cmbExporters.Text;
				cObject.Title = "ExporterName";
				cProject.cVars.RemoveByName(cObject.Title);
				cProject.cVars.Added(ref cObject);
			}
			catch (Exception ex)
			{
				ProjectData.SetProjectError(ex);
				Exception ex2 = ex;
				clsShared.cLog.AddAction(ex2, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		private void Panel1_Paint(object sender, PaintEventArgs e)
		{
		}

		private void cmbExporters_SelectedIndexChanged(object sender, EventArgs e)
		{
		}

		private void frmPickChapters_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (e.CloseReason == CloseReason.UserClosing)
			{
				Cancelled = true;
			}
		}
	}
}
